import java.util.Hashtable;
import java.util.LinkedList;


public class LLtable {
	private Hashtable<String,LinkedList<Rule>> entries;
	private nonterminal start;
	private terminal dollar;

	public LLtable(nonterminal start, terminal dollar){
		entries = new Hashtable<String,LinkedList<Rule>>();
		this.start = start;
		this.dollar = dollar;
	}

	public void put(nonterminal nonterminalKey, terminal terminalKey, LinkedList<Rule> value){
		if(value==null)
			return;
		this.entries.put(nonterminalKey.getSymbol()+terminalKey.getSymbol(), value);
	}


	public LinkedList<Rule> get(nonterminal nonterminalKey, terminal terminalKey){
		return this.entries.get(nonterminalKey.getSymbol()+terminalKey.getSymbol());
	}

	public LinkedList<Rule> get(nonterminal nonterminalKey, String terminalString){
		return this.entries.get(nonterminalKey.getSymbol()+terminalString);
	}

	public LinkedList<Rule> remove(nonterminal nonterminalKey, terminal terminalKey){
		return this.entries.remove(nonterminalKey.getSymbol()+terminalKey.getSymbol());
	}

	public nonterminal getStart() {
		return start;
	}

	public void setStart(nonterminal start) {
		this.start = start;
	}

	public terminal getDollar() {
		return dollar;
	}

	public void setDollar(terminal dollar) {
		this.dollar = dollar;
	}
}
